//
//  BZMangerFileViewController.m
//  penzer
//
//  Created by caiyc on 2018/11/15.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "BZMangerFileViewController.h"
#import "BZMineRegularItemTableViewCell.h"
#import "BZ_GHS_CatogryViewController.h"
#import "BZ_GHS_AddressViewController.h"
@interface BZMangerFileViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic,copy)NSMutableArray *table_Data;
@end

@implementation BZMangerFileViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"资料管理";
    [self configData];
    [self SetupTabView];
}


-(void)configData
{
    NSArray *subtitle = @[@"APPle 官方旗舰店",@"电子产品行业",@"手机",@"环球中心2121",@"15912146207@163.com",@"15912146207"];
    NSArray *titles = @[@"企业名称",@"业态",@"品类",@"地址管理",@"邮箱",@"电话"];
    for(int i =0;i<titles.count;i++){
        BZMineRegualTableModel*model = [BZMineRegualTableModel new];
        model.title = titles[i];
        if(i>1){
           model.canClick = 1;
        }else{
            model.canClick = 0;
        }
        model.titleColor = RGBA(51, 51, 51,0.5);
        model.imageStr = @"";
        model.sub_title = subtitle[i];
        [self.table_Data addObject:model];
    }
    [self.tableView reloadData];
}


-(void)SetupTabView{

    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([BZMineRegularItemTableViewCell class]) bundle:nil]  forCellReuseIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.estimatedRowHeight = 200;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.table_Data.count;
}



-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //BZMineRegularItemTableViewCell
    BZMineRegularItemTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    [cell setModel:self.table_Data[indexPath.row]];
    return cell;
   
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.row==2){
        BZ_GHS_CatogryViewController *vc = [[BZ_GHS_CatogryViewController alloc]init];
        [self.navigationController pushViewController:vc animated:NO];
    }else if (indexPath.row==3){
        BZ_GHS_AddressViewController *vc = [[BZ_GHS_AddressViewController alloc]init];
        [self.navigationController pushViewController:vc animated:NO];
    }
}

#pragma mark--getter&&setter
-(NSMutableArray *)table_Data{
    if(!_table_Data){
        _table_Data = [NSMutableArray array];
    }
    return _table_Data;
}

@end
